/*
 * Project.java
 *
 * Created on February 3, 2008, 2:21 PM
 *
 */

package projectprophet.core;

import java.util.ArrayList;
import java.io.*;

/**
 *
 * @author Gyula Szentirmay
 */
public class Project
{
	public final class Task extends projectprophet.core.Task
	{
		public Task()
		{
			index = Tasks.size();
			Tasks.add(this);
			TaskOrder.add(this);
		}
		
		// Task
		
		public Project getProject()
		{
			return Project.this;
		}
		
		public int getIndex()
		{
			return index;
		}
		
		// internal
		
		private final int index;
	}
	
	public final class Developer extends projectprophet.core.Developer
	{
		public Developer()
		{
			index = Developers.size();
			Developers.add(this);
		}
		
		// projectprophet.core.Developer
		
		public Project getProject()
		{
			return Project.this;
		}
		
		public int getIndex()
		{
			return index;
		}
		
		// internal
		
		private final int index;
	}
	
	public void setFileName(String newFileName)
	{
		fileName = newFileName;
	}
	
	public String getFileName()
	{
		return fileName;
	}
	
	public void save() throws java.io.IOException
	{
		PrintStream outputStream = new PrintStream(fileName);
		
		outputStream.print("Bagoy");
		//TODO: implement it
		
		outputStream.close();
	}
	
	public final int getNumberOfDevelopers()
	{
		return Developers.size();
	}
	
	public final Developer getDeveloper(int index)
	{
		return Developers.get(index);
	}
	
	private transient String fileName = null;
	private ArrayList<Task> Tasks = new ArrayList<Task>();
	private ArrayList<Task> TaskOrder = new ArrayList<Task>();
	private ArrayList<Developer> Developers = new ArrayList<Developer>();
}
